package com.ssyt.store.sys.entity;




import java.text.SimpleDateFormat;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.GenericGenerator;

@Entity
@Table(name = "sys_log")
@DynamicUpdate
// 以下为循环实体类的代码
public class SysLogEntity {
	// 循环设置属性
	@Id
	@GeneratedValue(generator = "myUuid")
	@GenericGenerator(name = "myUuid", strategy = "uuid")
	private String id;

	@Column(name = "user_code")
	private String userCode;

	@Column(name = "ip")
	private String ip;

	@Column(name = "operation")
	private String operation;
	
	@Column(name = "operate_time")
	private Date operateTime;
	
	@Transient
	private String operateTimeStr;
	

	// 构造方法
	public SysLogEntity() {
		super();
	}

	// 循环设置 set()、get()

	public void setUserCode(String userCode) {
		this.userCode = userCode;
	}

	public String getUserCode() {
		return this.userCode;
	}

	public void setIp(String ip) {
		this.ip = ip;
	}

	public String getIp() {
		return this.ip;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getId() {
		return this.id;
	}

	public void setOperation(String operation) {
		this.operation = operation;
	}

	public String getOperation() {
		return this.operation;
	}


	public Date getOperateTime() {
		return operateTime;
	}

	public void setOperateTime(Date operateTime) {
		this.operateTime = operateTime;
	}

	public String getOperateTimeStr() {
		SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		return dateFormat.format(operateTime);
	}

	public SysLogEntity(String id, String userCode, String ip, String operation) {
		super();
		this.id = id;
		this.userCode = userCode;
		this.ip = ip;
		this.operation = operation;
	}

	@Override
	public String toString() {
		return "SysLogEntity [id=" + id + ", userCode=" + userCode + ", ip="
				+ ip + ", operation=" + operation + "]";
	}

}
